<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class Psych::Emitter - psych: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="Handler.html">Psych::Handler</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-i-alias">#alias</a>
    <li ><a href="#method-i-canonical">#canonical</a>
    <li ><a href="#method-i-canonical-3D">#canonical=</a>
    <li ><a href="#method-i-end_document">#end_document</a>
    <li ><a href="#method-i-end_mapping">#end_mapping</a>
    <li ><a href="#method-i-end_sequence">#end_sequence</a>
    <li ><a href="#method-i-end_stream">#end_stream</a>
    <li ><a href="#method-i-indentation">#indentation</a>
    <li ><a href="#method-i-indentation-3D">#indentation=</a>
    <li ><a href="#method-i-line_width">#line_width</a>
    <li ><a href="#method-i-line_width-3D">#line_width=</a>
    <li ><a href="#method-i-scalar">#scalar</a>
    <li ><a href="#method-i-start_document">#start_document</a>
    <li ><a href="#method-i-start_mapping">#start_mapping</a>
    <li ><a href="#method-i-start_sequence">#start_sequence</a>
    <li ><a href="#method-i-start_stream">#start_stream</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-Psych::Emitter">
    <h1 id="class-Psych::Emitter" class="class">
      class Psych::Emitter
    </h1>

    <section class="description">
    
    </section>

      <section id="5Buntitled-5D" class="documentation-section">





                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-new" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          Psych::Emitter.new(io, options = Psych::Emitter::OPTIONS)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Create a new <a href="Emitter.html"><code>Psych::Emitter</code></a> that writes to <code>io</code>.</p>

                              <div class="method-source-code" id="new-source">
            <pre>static VALUE initialize(int argc, VALUE *argv, VALUE self)
{
    yaml_emitter_t * emitter;
    VALUE io, options;
    VALUE line_width;
    VALUE indent;
    VALUE canonical;

    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    if (rb_scan_args(argc, argv, &quot;11&quot;, &amp;io, &amp;options) == 2) {
        line_width = rb_funcall(options, id_line_width, 0);
        indent     = rb_funcall(options, id_indentation, 0);
        canonical  = rb_funcall(options, id_canonical, 0);

        yaml_emitter_set_width(emitter, NUM2INT(line_width));
        yaml_emitter_set_indent(emitter, NUM2INT(indent));
        yaml_emitter_set_canonical(emitter, Qtrue == canonical ? 1 : 0);
    }

    rb_ivar_set(self, id_io, io);
    yaml_emitter_set_output(emitter, writer, (void *)self);

    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-alias" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          alias(anchor)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Emit an alias with <code>anchor</code>.</p>

<p>See <a href="Handler.html#method-i-alias"><code>Psych::Handler#alias</code></a></p>

                              <div class="method-source-code" id="alias-source">
            <pre>static VALUE alias(VALUE self, VALUE anchor)
{
    yaml_emitter_t * emitter;
    yaml_event_t event;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    if(!NIL_P(anchor)) {
        Check_Type(anchor, T_STRING);
        anchor = rb_str_export_to_enc(anchor, rb_utf8_encoding());
    }

    yaml_alias_event_initialize(
            &amp;event,
            (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor))
            );

    emit(emitter, &amp;event);

    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-canonical" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          canonical
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Get the output style, canonical or not.</p>

                              <div class="method-source-code" id="canonical-source">
            <pre>static VALUE canonical(VALUE self)
{
    yaml_emitter_t * emitter;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    return (emitter-&gt;canonical == 0) ? Qfalse : Qtrue;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-canonical-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          canonical = true
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Set.html"><code>Set</code></a> the output style to canonical, or not.</p>

                              <div class="method-source-code" id="canonical-3D-source">
            <pre>static VALUE set_canonical(VALUE self, VALUE style)
{
    yaml_emitter_t * emitter;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    yaml_emitter_set_canonical(emitter, Qtrue == style ? 1 : 0);

    return style;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-end_document" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          end_document(implicit)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>End a document emission with an <code>implicit</code> ending.</p>

<p>See <a href="Handler.html#method-i-end_document"><code>Psych::Handler#end_document</code></a></p>

                              <div class="method-source-code" id="end_document-source">
            <pre>static VALUE end_document(VALUE self, VALUE imp)
{
    yaml_emitter_t * emitter;
    yaml_event_t event;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    yaml_document_end_event_initialize(&amp;event, imp ? 1 : 0);

    emit(emitter, &amp;event);

    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-end_mapping" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          end_mapping
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Emit the end of a mapping.</p>

<p>See <a href="Handler.html#method-i-end_mapping"><code>Psych::Handler#end_mapping</code></a></p>

                              <div class="method-source-code" id="end_mapping-source">
            <pre>static VALUE end_mapping(VALUE self)
{
    yaml_emitter_t * emitter;
    yaml_event_t event;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    yaml_mapping_end_event_initialize(&amp;event);

    emit(emitter, &amp;event);

    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-end_sequence" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          end_sequence
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>End sequence emission.</p>

<p>See <a href="Handler.html#method-i-end_sequence"><code>Psych::Handler#end_sequence</code></a></p>

                              <div class="method-source-code" id="end_sequence-source">
            <pre>static VALUE end_sequence(VALUE self)
{
    yaml_emitter_t * emitter;
    yaml_event_t event;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    yaml_sequence_end_event_initialize(&amp;event);

    emit(emitter, &amp;event);

    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-end_stream" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          end_stream
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>End a stream emission</p>

<p>See <a href="Handler.html#method-i-end_stream"><code>Psych::Handler#end_stream</code></a></p>

                              <div class="method-source-code" id="end_stream-source">
            <pre>static VALUE end_stream(VALUE self)
{
    yaml_emitter_t * emitter;
    yaml_event_t event;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    yaml_stream_end_event_initialize(&amp;event);

    emit(emitter, &amp;event);

    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-indentation" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          indentation
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Get the indentation level.</p>

                              <div class="method-source-code" id="indentation-source">
            <pre>static VALUE indentation(VALUE self)
{
    yaml_emitter_t * emitter;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    return INT2NUM(emitter-&gt;best_indent);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-indentation-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          indentation = level
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Set.html"><code>Set</code></a> the indentation level to <code>level</code>.  The level must be less than 10 and greater than 1.</p>

                              <div class="method-source-code" id="indentation-3D-source">
            <pre>static VALUE set_indentation(VALUE self, VALUE level)
{
    yaml_emitter_t * emitter;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    yaml_emitter_set_indent(emitter, NUM2INT(level));

    return level;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-line_width" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          line_width
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Get the preferred line width.</p>

                              <div class="method-source-code" id="line_width-source">
            <pre>static VALUE line_width(VALUE self)
{
    yaml_emitter_t * emitter;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    return INT2NUM(emitter-&gt;best_width);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-line_width-3D" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          line_width = width
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p><a href="Set.html"><code>Set</code></a> the preferred line with to <code>width</code>.</p>

                              <div class="method-source-code" id="line_width-3D-source">
            <pre>static VALUE set_line_width(VALUE self, VALUE width)
{
    yaml_emitter_t * emitter;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    yaml_emitter_set_width(emitter, NUM2INT(width));

    return width;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-scalar" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          scalar(value, anchor, tag, plain, quoted, style)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Emit a scalar with <code>value</code>, <code>anchor</code>, <code>tag</code>, and a <code>plain</code> or <code>quoted</code> string type with <code>style</code>.</p>

<p>See <a href="Handler.html#method-i-scalar"><code>Psych::Handler#scalar</code></a></p>

                              <div class="method-source-code" id="scalar-source">
            <pre>static VALUE scalar(
        VALUE self,
        VALUE value,
        VALUE anchor,
        VALUE tag,
        VALUE plain,
        VALUE quoted,
        VALUE style
        ) {
    yaml_emitter_t * emitter;
    yaml_event_t event;
    rb_encoding *encoding;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    Check_Type(value, T_STRING);

    encoding = rb_utf8_encoding();

    value = rb_str_export_to_enc(value, encoding);

    if(!NIL_P(anchor)) {
        Check_Type(anchor, T_STRING);
        anchor = rb_str_export_to_enc(anchor, encoding);
    }

    if(!NIL_P(tag)) {
        Check_Type(tag, T_STRING);
        tag = rb_str_export_to_enc(tag, encoding);
    }

    yaml_scalar_event_initialize(
            &amp;event,
            (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
            (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
            (yaml_char_t*)StringValuePtr(value),
            (int)RSTRING_LEN(value),
            plain ? 1 : 0,
            quoted ? 1 : 0,
            (yaml_scalar_style_t)NUM2INT(style)
            );

    emit(emitter, &amp;event);

    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-start_document" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          start_document(version, tags, implicit)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Start a document emission with YAML <code>version</code>, <code>tags</code>, and an <code>implicit</code> start.</p>

<p>See <a href="Handler.html#method-i-start_document"><code>Psych::Handler#start_document</code></a></p>

                              <div class="method-source-code" id="start_document-source">
            <pre>static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp)
{
    yaml_emitter_t * emitter;
    yaml_tag_directive_t * head = NULL;
    yaml_tag_directive_t * tail = NULL;
    yaml_event_t event;
    yaml_version_directive_t version_directive;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);


    Check_Type(version, T_ARRAY);

    if(RARRAY_LEN(version) &gt; 0) {
        VALUE major = rb_ary_entry(version, (long)0);
        VALUE minor = rb_ary_entry(version, (long)1);

        version_directive.major = NUM2INT(major);
        version_directive.minor = NUM2INT(minor);
    }

    if(RTEST(tags)) {
        long i = 0;
        long len;
        rb_encoding * encoding = rb_utf8_encoding();

        Check_Type(tags, T_ARRAY);

        len = RARRAY_LEN(tags);
        head  = xcalloc((size_t)len, sizeof(yaml_tag_directive_t));
        tail  = head;

        for(i = 0; i &lt; len &amp;&amp; i &lt; RARRAY_LEN(tags); i++) {
            VALUE tuple = RARRAY_AREF(tags, i);
            VALUE name;
            VALUE value;

            Check_Type(tuple, T_ARRAY);

            if(RARRAY_LEN(tuple) &lt; 2) {
                xfree(head);
                rb_raise(rb_eRuntimeError, &quot;tag tuple must be of length 2&quot;);
            }
            name  = RARRAY_AREF(tuple, 0);
            value = RARRAY_AREF(tuple, 1);
            StringValue(name);
            StringValue(value);
            name = rb_str_export_to_enc(name, encoding);
            value = rb_str_export_to_enc(value, encoding);

            tail-&gt;handle = (yaml_char_t *)StringValueCStr(name);
            tail-&gt;prefix = (yaml_char_t *)StringValueCStr(value);

            tail++;
        }
    }

    yaml_document_start_event_initialize(
            &amp;event,
            (RARRAY_LEN(version) &gt; 0) ? &amp;version_directive : NULL,
            head,
            tail,
            imp ? 1 : 0
            );

    emit(emitter, &amp;event);

    if(head) xfree(head);

    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-start_mapping" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          start_mapping(anchor, tag, implicit, style)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Start emitting a YAML map with <code>anchor</code>, <code>tag</code>, an <code>implicit</code> start and end, and <code>style</code>.</p>

<p>See <a href="Handler.html#method-i-start_mapping"><code>Psych::Handler#start_mapping</code></a></p>

                              <div class="method-source-code" id="start_mapping-source">
            <pre>static VALUE start_mapping(
        VALUE self,
        VALUE anchor,
        VALUE tag,
        VALUE implicit,
        VALUE style
        ) {
    yaml_emitter_t * emitter;
    yaml_event_t event;
    rb_encoding *encoding;

    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    encoding = rb_utf8_encoding();

    if(!NIL_P(anchor)) {
        Check_Type(anchor, T_STRING);
        anchor = rb_str_export_to_enc(anchor, encoding);
    }

    if(!NIL_P(tag)) {
        Check_Type(tag, T_STRING);
        tag = rb_str_export_to_enc(tag, encoding);
    }

    yaml_mapping_start_event_initialize(
            &amp;event,
            (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
            (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
            implicit ? 1 : 0,
            (yaml_mapping_style_t)NUM2INT(style)
            );

    emit(emitter, &amp;event);

    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-start_sequence" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          start_sequence(anchor, tag, implicit, style)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Start emitting a sequence with <code>anchor</code>, a <code>tag</code>, <code>implicit</code> sequence start and end, along with <code>style</code>.</p>

<p>See <a href="Handler.html#method-i-start_sequence"><code>Psych::Handler#start_sequence</code></a></p>

                              <div class="method-source-code" id="start_sequence-source">
            <pre>static VALUE start_sequence(
        VALUE self,
        VALUE anchor,
        VALUE tag,
        VALUE implicit,
        VALUE style
        ) {
    yaml_emitter_t * emitter;
    yaml_event_t event;

    rb_encoding * encoding = rb_utf8_encoding();

    if(!NIL_P(anchor)) {
        Check_Type(anchor, T_STRING);
        anchor = rb_str_export_to_enc(anchor, encoding);
    }

    if(!NIL_P(tag)) {
        Check_Type(tag, T_STRING);
        tag = rb_str_export_to_enc(tag, encoding);
    }

    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);

    yaml_sequence_start_event_initialize(
            &amp;event,
            (yaml_char_t *)(NIL_P(anchor) ? NULL : StringValueCStr(anchor)),
            (yaml_char_t *)(NIL_P(tag) ? NULL : StringValueCStr(tag)),
            implicit ? 1 : 0,
            (yaml_sequence_style_t)NUM2INT(style)
            );

    emit(emitter, &amp;event);

    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-start_stream" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          start_stream(encoding)
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Start a stream emission with <code>encoding</code></p>

<p>See <a href="Handler.html#method-i-start_stream"><code>Psych::Handler#start_stream</code></a></p>

                              <div class="method-source-code" id="start_stream-source">
            <pre>static VALUE start_stream(VALUE self, VALUE encoding)
{
    yaml_emitter_t * emitter;
    yaml_event_t event;
    TypedData_Get_Struct(self, yaml_emitter_t, &amp;psych_emitter_type, emitter);
    Check_Type(encoding, T_FIXNUM);

    yaml_stream_start_event_initialize(&amp;event, (yaml_encoding_t)NUM2INT(encoding));

    emit(emitter, &amp;event);

    return self;
}</pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is provided by <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>.</p><p><a href="https://jamesbritt.bandcamp.com/">Maximum R+D</a>.  </p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

